import request from '@/utils/request'

// 查询秒杀活动列表
export function listActivitiess(query) {
  return request({
    url: '/promotion/activitiess/list',
    method: 'get',
    params: query
  })
}

// 查询秒杀活动详细
export function getActivitiess(id) {
  return request({
    url: '/promotion/activitiess/' + id,
    method: 'get'
  })
}

// 新增秒杀活动
export function addActivitiess(data) {
  return request({
    url: '/promotion/activitiess',
    method: 'post',
    data: data
  })
}
// 新增时间段活动
export function addTimeSegment(data) {
  return request({
    url: '/promotion/activitiess/timeSegment',
    method: 'post',
    data: data
  })
}
// 删除秒杀活动时间片段
export function deleteTimeSegment(id) {
  return request({
    url: '/promotion/activitiess/timeSegment/' + id,
    method: 'delete'
  })
}

// 获取活动的时间段列表
export function getTimeSegments(activityId) {
  return request({
    url: '/promotion/activitiess/timeSegment/' + activityId,
    method: 'get'
  })
}
// 修改秒杀活动
export function updateActivitiess(data) {
  return request({
    url: '/promotion/activitiess',
    method: 'put',
    data: data
  })
}

// 删除秒杀活动
export function delActivitiess(id) {
  return request({
    url: '/promotion/activitiess/' + id,
    method: 'delete'
  })
}

// 获取活动商品列表
export function getActivityProducts(activityId) {
  return request({
    url: '/promotion/activitiess/activityProduct/activity/' + activityId,
    method: 'get'
  })
}

// 保存活动商品
export function saveActivityProduct(data) {
  return request({
    url: '/promotion/activitiess/activityProduct',
    method: 'post',
    data: data
  })
}

// 删除活动商品
export function deleteActivityProduct(id) {
  return request({
    url: '/promotion/activitiess/activityProduct/' + id,
    method: 'delete'
  })
}

